package com.haidechizi.fastadmin.modules.code.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.haidechizi.fastadmin.common.page.PageDto;
import com.haidechizi.fastadmin.common.utils.ObjectUtils;
import com.haidechizi.fastadmin.common.utils.PageInfo;
import com.haidechizi.fastadmin.modules.code.entity.PropCodeConfig;
import com.haidechizi.fastadmin.modules.code.dao.PropCodeConfigDao;
import com.haidechizi.fastadmin.modules.code.service.PropCodeConfigService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import com.haidechizi.fastadmin.modules.sys.service.SysDictService;
import org.springframework.beans.factory.annotation.Autowired;
/**
 * 资源文件Service
 * @author wangdejun
 * @version 2020-11-05
 */
@Service
@Transactional(readOnly = true)
public class PropCodeConfigServiceImpl extends ServiceImpl<PropCodeConfigDao, PropCodeConfig> implements PropCodeConfigService {

	@Autowired
	private SysDictService sysDictService;


	/**
	 * 分页查询
	 *
	 * @param pageDto
	 * @param propCodeConfig
	 * @return
	 */
	@Override
    public PageInfo findPage(PageDto pageDto, PropCodeConfig propCodeConfig) {
        Page<PropCodeConfig> page = this.selectPage(
                pageDto.cover2Page(),
                new EntityWrapper<PropCodeConfig>()
        );
		List<PropCodeConfig> propCodeConfigList = page.getRecords();
		for (PropCodeConfig propCodeConfig1: propCodeConfigList) {

			propCodeConfig1.setLanguageType(sysDictService.coverList2Labels(propCodeConfig1.getLanguageType(),"language_type"));

		}
        return new PageInfo(page);
    }
	
}